package com.qf.mvc01.controller;

import com.qf.mvc01.entity.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping("/user")
public class UserController {

    @RequestMapping("/addUser")
    public String addUser(User user){
        System.out.println(user);
        return "redirect:listUser";
    }

    @RequestMapping("/delUser/{id}")
    public String delUser(@PathVariable("id") Integer id){
        System.out.println(id);
        return "redirect:/user/listUser";
    }

    @RequestMapping("/listUser")
    public String listUser(){
        System.out.println("查询数据");
        return "forward:/views/user.html";
    }
}
